package com.demo.dropdataack.entity;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

import java.util.HashMap;



//推送数据


@Data
public class Result {

    private int code ;
    private String message ;

    private HashMap<String,Object> data = new HashMap<>(8) ;

    public Result(int code) {
        this.code = code;
        if(code == 0){
            message = "OK";
        }
    }

    public Result(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result addData(String key,Object  param){
        data.put(key,param) ;

        return this ;
    }

    @Override
    public String toString() {
        return JSONObject.toJSONString(this) ;
    }
}

